/**
 * @author tibi
 */
Ext.namespace('Softab');

Softab.RenderEntityGridMenu = function(grid, rowIndex, e){
    e.stopEvent();
    var coords = e.getXY();
    entityGrab = this.id.split("_");
    selectedRecord = grid.getStore().getAt(rowIndex);
    entityID = entityGrab[0];
    var messageContextMenu = new Ext.menu.Menu({
        id: 'messageContextMenu',
        items: [{
            text: 'Properties',
            //handler: properties,
            scope: this
        }, {
            text: 'Editare inregistrare',
            scope: this,
            handler: function(){
                Softab.EntityEditRecordHandler(entityID, selectedRecord.data.ID);
            }
        }, {
            text: 'Adauga inregistrare',
            scope: this,
            handler: function(){
                Softab.EntityAddRecordHandler(entityID);
            }
        }]
    });
    messageContextMenu.showAt([coords[0], coords[1]]);
    e.preventDefault();
}